** Replication Code for:
** Terrorism Activates Ethnocentrism to Explain Greater Willingness to 
** Sacrifice Civil Liberties: Evidence from Germany
** Authors: Christina Novak Hansen and Peter Thisted Dinesen 
** Date: 10/02/2021

*-------------------------------------------------------------------------------

clear all
use GGSS2016_analysis.dta
svyset xs11 [pweight=wghtpew], vce(linearized)
keep if german==1 & governmentsplit!=.					

*-------------------------------------------------------------------------------
*Appendix R: Additional robustness check: The activation effect using 
*alternative control periods
*-------------------------------------------------------------------------------



								*Table R1*

*Full ethnocentrism index and civil liberties with reference to terrorism
*Control group 12/04/2016-02/05/2016
svy: regress st_terrori c.st_ethno i.sex st_age st_age2 i.proedu2 i.work2 if control_1!=. 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label replace 
svy: regress st_terrori c.st_ethno i.control_1 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append 
svy: regress st_terrori c.st_ethno##i.control_1 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append


*Control group 03/05/2016-22/05/2016				
svy: regress st_terrori c.st_ethno i.sex st_age st_age2 i.proedu2 i.work2 if control_2!=. 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append 
svy: regress st_terrori c.st_ethno i.control_2 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append 
svy: regress st_terrori c.st_ethno##i.control_2 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append


*Control group 23/05/2016-11/06/2016
svy: regress st_terrori c.st_ethno i.sex st_age st_age2 i.proedu2 i.work2 if control_3!=. 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append 
svy: regress st_terrori c.st_ethno i.control_3 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append 
svy: regress st_terrori c.st_ethno##i.control_3 i.sex st_age st_age2 i.proedu2 i.work2 
outreg2 using Table_R1.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label append

********************************************************************************

				*NOT SHOWN IN ONLINE APPENDIX*

*Marginsplot for main studied groups (standard) and alternative control groups

*Marginsplot for normal control
svy: regress st_terrori c.st_ethno##i.treatment1 i.sex st_age st_age2 i.proedu2 i.work2
margins, at( treatment1=(0,1) st_ethno=(.375) work2=(2) (mean) sex st_age st_age2 proedu2) vce(unconditional)
marginsplot, xdimension(treatment1) name(graph_t1, replace) recast(scatter) ytitle("") ylabel(0.4(0.05)0.8, labsize(medium) angle(horizontal) grid) xtitle("") xlabel(-0.5 "" 0 "" 1 "" 1.5 "", nolabels noticks) title("Standard", size(medium)) xsize(2.2) plotregion(ilcolor(black) ilwidth(thick) ilpattern(solid))

*Control group 12/04/2016-02/05/2016
svy: regress st_terrori c.st_ethno##i.control_1 i.sex st_age st_age2 i.proedu2 i.work2 
margins, at( control_1=(0,1) st_ethno=(.375) work2=(2) (mean) sex st_age st_age2 proedu2) vce(unconditional)
marginsplot, xdimension(control_1) name(graph_c1, replace) recast(scatter) ytitle("") ylabel(0.4(0.05)0.8, nolabels grid) xtitle("") xlabel(-0.5 "" 0 "" 1 "" 1.5 "", nolabels noticks) title("Alternative 1") xsize(2.2)

*Control group 03/05/2016-22/05/2016				
svy: regress st_terrori c.st_ethno##i.control_2 i.sex st_age st_age2 i.proedu2 i.work2 
margins, at( control_2=(0,1) st_ethno=(.375) work2=(2) (mean) sex st_age st_age2 proedu2) vce(unconditional)
marginsplot, xdimension(control_2) name(graph_c2, replace) recast(scatter) ytitle("") ylabel(0.4(0.05)0.8, nolabels grid) xtitle("") xlabel(-0.5 "" 0 "" 1 "" 1.5 "", nolabels noticks) title("Alternative 2") xsize(2.2)

*Control group 23/05/2016-11/06/2016
svy: regress st_terrori c.st_ethno##i.control_3 i.sex st_age st_age2 i.proedu2 i.work2 
margins, at( control_3=(0,1) st_ethno=(.375) work2=(2) (mean) sex st_age st_age2 proedu2) vce(unconditional)
marginsplot, xdimension(control_3) name(graph_c3, replace) recast(scatter) ytitle("") ylabel(0.4(0.05)0.8, nolabels grid) xtitle("") xlabel(-0.5 "" 0 "" 1 "" 1.5 "", nolabels noticks) title("Alternative 3") xsize(2.2)

grc1leg graph_t1 graph_c1 graph_c2 graph_c3, cols(4) ycommon graphregion(fcolor(white) lcolor(white)) iscale(0.9) xsize(7) imargin(0 0 0 0) graphregion(margin(medium))











